<?php

class Rule_Email extends Rule_Abstract
{
	public $_config = array('msg' => 'Invalid email address');

	const PATTERN = '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/';

	public function isValid($value, $params = null)
	{
		if (is_string($value) && $value)
		{
			return preg_match(self::PATTERN, $value);
		}
		return FALSE;
	}

}
